<template>
  <div class="login">
    <login @login="login" />
  </div>
</template>

<script>
import login from "@/modules/fifty/views/demo50/form-wave/form-wave.vue";
import { mapActions, mapGetters } from "vuex";
import axios from "axios";
import qs from "qs";
export default {
  components: { login },
  data() {
    return {
      userName: "",
      passWord: "",
      pages: {},
    };
  },
  methods: {
    ...mapActions("login", ["setUserName", "setPassWord", "setLogin"]),
    login(obj) {
      this.$toast.showMessage('测试')
      let { userName, passWord } = obj;
      if (!userName || !passWord) {
        this.$message.warning("缺少字段");
        return;
      }
      this.setUserName(userName);
      this.setPassWord(passWord);
      this.setLogin(true);
      this.$router.push({ path: this.$config.home });
    },
  },
  mounted() {
    return;
    this.pages = API_CONFIG;
    let params = {
      appid: "ww9a7c64fb8c3e1acd",
      redirect_uri: "http://192.168.101.19:8078",
      response_type: "code",
      scope: "http://192.168.101.19:8078",
      agentid: "1000005",
      state: "ceshi",
    };

    axios
      .post(
        "https://open.weixin.qq.com/connect/oauth2/authorize?" +
          qs.stringify(params)
      )
      .then((res) => {
        alert(1);
      });
  },
};
</script>

<style lang="scss" scoped>
.login {
  .login-info {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .login-button {
    display: flex;
    justify-content: center;
  }
}
</style>